//导入依赖
import {createRouter,createWebHashHistory} from 'vue-router'
import Home from '../components/Home.vue'
import Login from '../components/Login.vue'


//创建路由对象
const router = createRouter({
    //1.定义历史记录对象
    history: createWebHashHistory(),

    //2.定义路由映射关系  url 与 组件的映射
    routes: [

        //3.定义路由规则
        //component 在默认的位置显示组件
        //{path: '/', component: Home},

        //components 在指定的位置显示组件
        {path: '/', components: {myView: Home}},
        {path: '/home', component: Home},
        {path: '/login', component: Login}
    ]
})

//暴露路由对象
export default router
